import org.apache.flink.api.common.accumulators.Accumulator;

public class Demo06_selfAccumulator implements Accumulator<Double,String> {

    String result = "";

    @Override
    public void add(Double value) {
        this.result += value+"\t";
    }

    @Override
    public String getLocalValue() {
        return this.result;
    }

    @Override
    public void resetLocal() {
        this.result = "";
    }

    @Override
    public void merge(Accumulator<Double, String> other) {
        this.result += other.getLocalValue();
    }

    @Override
    public Accumulator<Double, String> clone() {
        Demo06_selfAccumulator selfAccumulator = new Demo06_selfAccumulator();
        selfAccumulator.result = this.result;
        return selfAccumulator;
    }
}
